from config import HOST
import requests
class ApiApproveTrust:
    # 初始化
    def __init__(self, session):
        # 获取session对象
        self.session = session
        # 认证url
        self.__url_approve = HOST + "/member/realname/approverealname"
        # 查询认证状态url
        self.__url_approve_status = HOST + "/member/member/getapprove"
        # 开户url
        self.__url_trust = HOST + "/trust/trust/register"
        # 充值    获取充值验证码     图片验证码url
        self.__url_img_code = HOST + "/common/public/verifycode/{}"
        # 充值url
        self.__url_recharge = HOST + "/trust/trust/recharge"


    # 认证
    def get_url_approve(self):
        data={
            "realname":"张三",
            "card_id":"1246819481982292"
        }
        return self.session.post(url=self.__url_approve, data=data, files={"x": "y"})

    # 获取认证信息
    def get_url_approve_status(self):
        return self.session.post(url=self.__url_approve_status)

    # 开户
    def get_url_trust(self):
        return self.session.post(url=self.__url_trust)


    # 获取重置验证码
    def get_url_img_code(self,random):
        return self.session.get(url=self.__url_img_code.format(random))

    # 充值接口
    def get_url_recharge(self,valicode):
        data = {
            "paymentType": "chinapnrTrust",
            "amount": "1000",
            "formStr":"reForm",
            "valicode":valicode
        }
        return self.session.get(url=self.__url_recharge,data=data)